<template>
  <div class="approvalOpinion">
      <Form
        :model="approvalForm"
        ref="approvalForm"
        :rules="ruleValidate"
        :label-width="100"
      >
        <Form-item prop="result" :label="'审批结果：'">
            <RadioGroup v-model="approvalForm.result">
                <Radio label="通过"></Radio>
                <Radio label="驳回"></Radio>
            </RadioGroup>
        </Form-item>
        <Form-item prop="approverComments" label="审批意见：">
            <Input v-model="approvalForm.approverComments" :maxlength="4000" type="textarea" :rows="4" placeholder="请输入" />
        </Form-item>
      </Form>
  </div>
</template>

<script>
export default {
  name: "approvalOpinion",
  components: {},
  props: {
  },
  data() {
    return {
        right: 'right',
        ruleValidate: {
            result: [
                { required: true, message: '请选择审批结果', trigger: 'blur' }
            ],
        },
        approvalForm: {
            result: '',
            approverComments: ''
        }
    };
  },
  created() {
    this.init();
  },
  mounted() {},
  methods: {
    init() {
      this.$emit("SetTitle", '审批');
      this.$emit("SetPageWidth", 500);
      this.$emit("SetPageMinHeight", 150);
      this.$emit("SetPageActions", [
        {
          text: "确定",
          handle: () => {
            this.$refs.approvalForm.validate((valid) => {
                if (valid) {
                    this.$emit("Close", this.approvalForm);
                }
            })
          }
        },
        {
          text: "取消",
          handle: () => {
            this.$emit("Close");
          }
        }
      ]);
    },
  },
  computed: {},
  watch: {
  }
};
</script>

<style lang='less' scoped >
.approvalOpinion {
    .ivu-input-wrapper {
        width: 90%;
    }
}
</style>
